
define(function(require, exports, module) {
    var component = {};
    component.vue = function(params) {
        var vm = new Vue({
        el: '#component_get_shop_id_content',
        data: {
            items: [],
            title:'请选择门店',
            type:'shop',
        },
        created: function() {
            
             if(params.title){
               this.title = params.title;
             }
             if(params.type){
               this.type = params.type;
             }
              this.getShopList();
        },
         
        methods: {
            get_shop_id: function(shop_id) {
                params.success?params.success(shop_id):'';
                 
            },
                
           getShopList:function(){
                    var that = this;   
                    app.get("mall/shop/get", {
                      type:this.type,
                    }, function (res) {
                      if (res.code != 200) {
                         app.alert(res.msg);
                         return ;
                      }                     
                      that.items=res.data.list;  
                      if(that.items.length==1){
                         that.get_shop_id(that.items[0].id);
                      }     
                    });
                }
        }
        });
        return vm;
    };
    
  module.exports = component;

});